import http from '.';
import { getItem } from '../utils/storage';

/**
 * 获取图片验证码
 */
export const getCaptchas = () => http.post('/v1/captchas');

/**
 * 账号密码登录
 */
export const accountLogin = (username, password, captcha_code) =>
    http.post('/v2/login', { username, password, captcha_code });

/**
 * 获取用户信息
 */
export const fetchUser = () =>
    http.get('/v1/user', { user_id: getItem('user_id') });
